//
// Created by cy on 22-5-4.
//

#ifndef CEC_VISION_CALCULATE_H
#define CEC_VISION_CALCULATE_H

#include "all.hpp"
#include "armor.hpp"
#include "trance.hpp"

struct sutPreParam {
    float shootRate;
    float stm32Pitch;
    float stm32Yaw;
    int frameDelay;
    bool predictFlag;
    enuOutPutType outPutType;
    enuCarType carType;
};

struct sutCalculateConfigs {
    double offsetPitch;
    double offsetYaw;
    double gravity;
    double smallArmorWidth;
    double smallArmorHeight;
    double bigArmorWidth;
    double bigArmorHeight;
    double focalX;
    double focalY;
    double processNoise;
    double measureNoise;
};

struct sutArmorTravel {
    sutArmorData startArmor;
    sutArmorData endArmor;
    sutArmorData lastArmor;
    bool finished;
    bool isOk;
};



class CalculatorPrivate;

class Calculator {

public:
    explicit Calculator(const std::string &configFile, bool debug = false);

    ~Calculator();

    bool update(const ArmorDataVector &armor, const sutPreParam &preParam);

    sutNucData &result();

    sutPreParam &resultPreParam();

    void updateConfigs(const sutCalculateConfigs &configs);

    void saveConfigs(const std::string &configFile);

    sutCalculateConfigs &getConfigs();

    void openDebug();

    void closeDebug();

    Calculator(const Calculator &) = delete;

    Calculator &operator=(const Calculator) = delete;

private:
    CalculatorPrivate *m_ptr;
};

#endif //CEC_VISION_CALCULATE_H
